package com.ywu.application.standard.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName RestTemplateConfig
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/11/24 17:49
 * @Version 1.0
 **/
@Configuration
public class RestTemplateConfiguration {

    @Bean("devOpsRestTemplate")
    public RestTemplate createCustomRestTemplate() {
        HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
        requestFactory.setConnectTimeout(5000); // 设置连接超时时间
        requestFactory.setReadTimeout(5000); // 设置读取超时时间

        return new RestTemplate(requestFactory);
    }
}
